#ifndef _DATUM_PAGE_H_
#define _DATUM_PAGE_H_

#include "storage/Page.h"
#include "contest_interface.h"

// there are two types of page access
typedef enum accessType{

    // read only on the page
    ReadMode,
    // write on the page: record insertion and update
    WriteMode,
} AccessType;

class DatumPage : public Page
{
public:
    DatumPage(int unit_s, BufferManager* bm, AccessType t, AttributeType *at, int dim);
    ~DatumPage();

    DatumPage(const DatumPage &dp);
    
    bool InsertRecord(Record* rec);
    
    DatumPage* GetNextDatumPage(){return next;};
    
    static void CopyDatumPage(DatumPage* dest, DatumPage* source);
    
    void SetNextPage(DatumPage* next_page){next = next_page;};
    
    void PrintAllRecords();
    
private:
    
    DatumPage* next;
    
    int unit_size;
    
    int unit_num;
    
	AttributeType	*index_type;

    int attr_num;
};

#endif
